Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable exporting (registered) submission metadata #4962

Merged
merged 4 commits into from
Dec 27, 2024

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented Dec 20, 2024

Closes #4930

Changes

  • Added custom admin page and link to it from the form statistics
  • Implemented exporting submission statistics based on timeline logs

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Copy link

codecov bot commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.65%. Comparing base (e5e8246) to head (d8b516e).
Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4962      +/-   ##
==========================================
+ Coverage   96.64%   96.65%   +0.01%     
==========================================
  Files         760      762       +2     
  Lines       25844    25935      +91     
  Branches     3387     3391       +4     
==========================================
+ Hits        24976    25067      +91     
  Misses        604      604              
  Partials      264      264              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sergei-maertens sergei-maertens marked this pull request as ready for review December 20, 2024 16:09
def export(self) -> Dataset:
start_date: date = self.cleaned_data["start_date"]
end_date: date = self.cleaned_data["end_date"]
return export_registration_statistics(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a bit picky, but why do you define the dates as variables? Is it (only) to specify the date typing?
Otherwise, why not just pass the cleaned_data directly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of reasons, all summarized as "loose coupling".

  1. A simple export_registration_statistics with plain parameters is easy to understand when you're in that function, without adding the cognitive overhead of knowing what the form structure looks like and what's in cleaned_data.
  2. Building on top of 1., I can modify my form implementation and interface without needing to touch the actual export function. If I have to touch the export function, I'm very well aware that I'm changing a Python API and need to check for possible other call sites.
  3. The export function can also be called through other user interfaces, e.g. a management command/CLI where the date parameters get passed/parsed differently, or a celery task could be wired up to periodically generate these and automatically prepare/send the exports.
  4. Explicit type annotations are nice indeed :)

@robinmolen
Copy link
Contributor

robinmolen commented Dec 24, 2024

I've tried the export, and was missing some submissions.. I'm not yet sure why, i'll take another look later today..

Export submission statistics based on the timeline logs.

Note: if the timeline logs are pruned, this affects the exports. It's
up to the users to periodically create these exports and save them
somewhere if they periodically prune log records.

Note 2: filtering on forms only works on new log records, as existing
log records don't have the form ID stored in the structured data.

Submissions that were deleted for which existing log records are
present will display 'unknown' for some columns because the relevant
information has been deleted. Only from 3.0 onwards are we snapshotting
the data required for the exports.
Ensures that the filters are correctly implemented.
@sergei-maertens sergei-maertens force-pushed the feature/4930-bulk-export-submission-stats branch from 5627a76 to d8b516e Compare December 27, 2024 11:44
@sergei-maertens sergei-maertens merged commit dbd9a35 into master Dec 27, 2024
33 checks passed
@sergei-maertens sergei-maertens deleted the feature/4930-bulk-export-submission-stats branch December 27, 2024 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As admin, I want to create an export of all submissions to compare them with registration systems
2 participants